package com.bw.zhuangao5___day002.Fragment.Home.Fragment1;

import com.bw.mvp.M.BannerModel;

import java.util.List;

import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;


/**
 * create by ertu
 * create on 2021/9/24
 * description
 */
public class HomeModel extends BannerModel implements HomeContion.MymodelH {


    @Override
    public void getMymodelH( HomeCallbck homeCallbck) {
        HomeOkhttps.getHomeOkhttps().retrofits().create(HomeApi.class).gethomesH()
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io())
                .subscribe(new Observer<JavaHome>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(JavaHome javaHome) {
                        List<JavaHome.ResBean.VerticalBean> verticalBeanList = javaHome.getRes().getVertical();
                        homeCallbck.suusshomeH(verticalBeanList);
                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onComplete() {

                    }
                });

    }
}
